﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

//////////////////////////////////////////////////////////////////////////
//Course.cs                                                             //
//Last Edited: 20 Mar 2012                                              //
//                                                                      //
//Object that holds information necessary for courses                   //
//////////////////////////////////////////////////////////////////////////
public class Course
{
    protected String courseID;
    protected String dpt;
    protected String num;
    protected String name;
    protected Double credits;
    protected String term;
    protected List<Course> preReqs;
    protected List<Course> coReqs;
    protected List<int> tags;
    public Course()
    {
    }
    /** int courseID, String dpt, String num, String name, Double credits, string term
     * */
    public Course(String courseID, String dpt, String num, String name, Double credits, string term)
	{
        this.courseID = courseID;
        this.dpt = dpt;
        this.num = num;
        this.name = name;
        this.credits = credits;
        this.term = term;
	}
    public Course copy()
    {
        return new Course(courseID, dpt, num, name, credits, term);
    }
    public String getCourseID()
    {
        return courseID;
    }
    public String getDpt()
    {
        return dpt;
    }
    public String getNum()
    {
        return num;
    }
    public String getName()
    {
        return name;
    }
    public Double getCredits()
    {
        return credits;
    }
    public String getTerm()
    {
        return term;
    }
    public int getYear()
    {
        int year = Convert.ToInt32(term.Substring(0,4));
        if(getSemester().Equals("Fall"))
            year = year-1;
        return year;
    }
    public String getSemester()
    {
        String termCodeConversion = SharedFunctions.convertFromTermCode(term);
        int spaceIndex = termCodeConversion.IndexOf(" ");
        String semester = termCodeConversion.Substring(0, spaceIndex);
        return semester;
    }
    public void setTerm(String termCode)
    {
        this.term = termCode;
    }
    public void setCourseID(String id)
    {
        this.courseID = id;
    }
}